package com.zhoufy.tomcat.server;

import com.zhoufy.tomcat.utils.Request;
import com.zhoufy.tomcat.utils.Response;

/**
 * Created with IntelliJ IDEA by ChouFy on 2020-03-30.
 *
 * @author zhoufy
 */
public abstract class HttpServlet implements  Servlet {


    public abstract void doGet(Request request, Response response) throws Exception;

    public abstract void doPost(Request request, Response response) throws Exception;


    @Override
    public void service(Request request, Response response) throws Exception {
        if("GET".equalsIgnoreCase(request.getMethod())) {
            doGet(request, response);
        } else {
            doPost(request, response);
        }
    }
}
